"""Price validation and dropping items with no prices"""
from scrapy.exceptions import DropItem


class PricePipeline(object):
    """demo"""
    vat_factor = 1.15

    def process_item(self, item, spider):
        if item.get('price'):
            if item.get('price_excludes_vat'):
                item['price'] *= self.vat_factor
            return item
        else:
            raise DropItem("Missing price in %s" % item)
